
/***************************************************************************************************
 *
 * Project: HZFlashcards
 *
 * Class: ToolBarPanel
 *
 * File name: ToolBarPanel.java
 *
 * Aug 23, 2007
 *
 **************************************************************************************************/

package com.eastmountain.chinese.gui.controllers;

import java.awt.Color;
import java.awt.GridBagConstraints;
import java.util.Vector;

import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.JButton;
import javax.swing.JToolBar;
import javax.swing.border.Border;

//import com.eastmountain.chinese.common.Enums.ToolBarButtons;
import com.eastmountain.chinese.gui.HanZiDisplayPanel;

@SuppressWarnings("serial")
public class ToolBarPanel extends JToolBar {

    private GridBagConstraints toolBarConstraints;

    private HanZiDisplayPanel hanZiDisplayPanel;

    private Vector<AbstractButton> toolBarButtons;
    private ToolBarActions toolBarActions;

    static final int COMPONENT_WIDTH = 60;
    static final int COMPONENT_HEIGHT = 30;
    
    private Border linedBorder = BorderFactory.createLineBorder( Color.GRAY, 2 );

    /***********************************************************************************************
     *
     * ToolBarPanel
     *
     **********************************************************************************************/

    public ToolBarPanel( HanZiDisplayPanel hanZiDisplayPanel  /*, Actions toolBarActions */  ) {

        this.hanZiDisplayPanel = hanZiDisplayPanel;

        setFloatable( true );
        setRollover( true );
        setBorder( linedBorder );

        toolBarActions = new ToolBarActions( hanZiDisplayPanel );

        toolBarButtons = toolBarActions.setUpButtons();

        //toolBarActions.enablePreviousNextLesson( false );

        add( Box.createHorizontalGlue() );

        for ( AbstractButton button : toolBarButtons  ) {

            add( button );

        }

        add( Box.createHorizontalGlue() );

    }
    
    public void enableDisableButton( ToolBarButtons button, boolean enable ) {
        
        toolBarActions.enableDisableButton( button, enable );

    }

}
